package com.jic.interaction.ChinaPost.service.impl;

import com.alibaba.fastjson.JSON;
import com.jic.interaction.common.utils.HttpClientUtil;
import com.jic.interaction.ChinaPost.model.vo.request.SelectPaymentRequest;
import com.jic.interaction.ChinaPost.model.vo.response.SelectPaymentResponse;
import com.jic.interaction.ChinaPost.service.SelectPaymentService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.io.IOException;
import java.util.Map;
import java.util.concurrent.ExecutionException;

@Service
public class SelectPaymentServiceImpl implements SelectPaymentService {

    @Value("${route.value}")
    private String url;

    @Override
    public SelectPaymentResponse selectPaymnt(SelectPaymentRequest request) {
        //url路径
        String url = this.url + "/m/dbs-front/compensationPay/query";
        try {
            Map<String, String> params = JSON.parseObject(JSON.toJSONString(request), Map.class);
            String s = HttpClientUtil.requestPath(url, params, JSON.toJSONString(request));
            return null;
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (ExecutionException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
}
